Automatic Differentiation of C++ Codes for Large-Scale Scientific Computing
نویسندگان
چکیده
We discuss computing first derivatives for models based on elements, such as large-scale finite-element PDE discretizations, implemented in the C++ programming language. We use a hybrid technique of automatic differentiation (AD) and manual assembly, with local elementlevel derivatives computed via AD and manually summed into the global derivative. C++ templating and operator overloading work well for both forwardand reverse-mode derivative computations. We found that AD derivative computations compared favorably in time to finite differencing for a scalable finite-element discretization of a convection-diffusion problem in two dimensions. Computing derivatives is ubiquitous in scientific computing; examples include algorithms for nonlinear equation solving, optimization, stability analysis, and implicit time integration. Computing derivatives quickly and accurately improves both the efficiency and robustness of these numerical algorithms, particularly in the presence of ill-conditioning. In this paper, we discuss computing first derivatives of element-based models implemented in ANSI/ISO C++. We use the term “element” in a broad sense to encompass any model whose computation consists of repeated evaluations of a small set of functions, each involving relatively few of the variables of the overall problem. Many classes of models fall into this category, including finite-element and finite-volume PDE discretizations and network models. We use a hybrid technique of automatic differentiation (AD) and manual assembly similar to [1, 2] to carry out the model evaluation and derivative computation one element at a time. This decomposition is discussed in more detail in Section 1, which generalizes the ideas in [2] to general element-based models and additionally describes how to compute the global adjoint. We focus on ANSI/ISO C++ codes because much modern scientific code development is done in C++. Since no source transformation tools for C++ were available to us, we used C++ operator overloading to implement AD for computing the element-level derivatives. We assume the reader is familiar with AD and the methods for implementing it; see [3] for a good introduction to these concepts. We used two separate AD packages: the public domain package Fad [4] for forward-mode AD and our own reverse-mode package Rad [5]. ?? Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy under Contract DEAC04-94AL85000. This is SAND2006-0902C.
منابع مشابه
Computing Large Sparse Jacobian Matrices Using Automatic Differentiation
The computation of large sparse Jacobian matrices is required in many important large-scale scienti c problems. We consider three approaches to computing such matrices: hand-coding, di erence approximations, and automatic di erentiation using the ADIFOR (Automatic Di erentiation in Fortran) tool. We compare the numerical reliability and computational e ciency of these approaches on applications...
متن کاملAlgorithmic Differentiation of a Complex C++ Code with Underlying Libraries
Algorithmic differentiation (AD) is a mathematical concept which evolved over the last decades to a very robust and well understood tool for computation of derivatives. It can be applied to mathematical algorithms, codes for numerical simulation, and whenever derivatives are needed. In this paper we report on the algorithmic differentiation of the discontinuous Galerkin solver padge, a large an...
متن کاملChapter 1 Performance Characteristics of Potential Petascale Scientific Applications
After a decade where HEC (high-end computing) capability was dominated by the rapid pace of improvements to CPU clock frequency, the performance of next-generation supercomputers is increasingly differentiated by varying interconnect designs and levels of integration. Understanding the tradeoffs of these system designs, in the context of high-end numerical simulations, is a key step towards mak...
متن کاملppOpen-HPC: Open Source Infrastructure for Development and Execution of Large-Scale Scientific Applications on Post-Peta-Scale Supercomputers with Automatic Tuning (AT)
We propose an open source infrastructure for development and execution of optimized and reliable simulation codes on post-petascale (pp) parallel computers with heterogeneous computing nodes which consist of multicore CPU’s and accelerators., named “ppOpen-HPC”. ppOpen-HPC consists of various types of libraries, which covers various types of procedures for scientific computations. Source code d...
متن کاملUse of Structure Codes (Counts) for Computing Topological Indices of Carbon Nanotubes: Sadhana (Sd) Index of Phenylenes and its Hexagonal Squeezes
Structural codes vis-a-vis structural counts, like polynomials of a molecular graph, are important in computing graph-theoretical descriptors which are commonly known as topological indices. These indices are most important for characterizing carbon nanotubes (CNTs). In this paper we have computed Sadhana index (Sd) for phenylenes and their hexagonal squeezes using structural codes (counts). Sa...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2006